<?php
declare (strict_types = 1);

namespace app\admin\controller;
use think\facade\View;
use think\facade\Db;
class Dic extends \app\admin\controller\Base
{
  public function remove()
  {
    $id = input('id');
    $ret = Db::name('setting')
              ->whereIn('id',$id)
              ->delete();
    if ($ret) {
      # code...
    }
    return $this->doSuccess('ok');
  }
  public function update()
  {
    $post = input('post.');
    $id = input('id');
    $pk = Db::name('setting')
              ->where('id',$id)
              ->update($post);
    if ($pk > 0) {
      return $this->doSuccess('ok');
    }
    return $this->doSuccess('ok');
  }
  public function insert()
  {
    $form = input('post.');
    unset($form['id']);
    $form['ctime'] = time();
    $pk = Db::name('setting')
              // ->where('id',$id)
              ->insert($form);
    return $this->doSuccess('ok');
    # code...
  }
}
